import java.sql.Time;
import java.util.TimerTask;

public class Timer {
    public static void main(String[] args) {
        java.util.Timer timer=new java.util.Timer();

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("我是任务1");
            }
        },1000,5000);

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("我是任务2");
            }
        },2000,5000);

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("我是任务3");
            }
        },3000,5000);

    }
}
